<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <style type="text/css">
        .box {
            text-align: center;
            position: absolute;
            margin: 200px auto;
            left: 40%;
        }
        .table {
            width: 50%;
            /* 两条边框重合 */
            border-collapse: collapse;
            border: 2px black solid;
            /* 文字居中 */
            text-align: center;
            /* 鼠标样式 */
            cursor: pointer;
        }
        .table td, .table th {
            font-size: 15px;
            border: 1px solid #000000;
        }
        .table th {
            font-size: 17px;
            /* 文字居中 */
            text-align: center;
            padding: 7px 70px;
            background-color: #555;
            color: white;
        }
        /* 设置奇数元素颜色 */
        .table tr:nth-child(even) {
            background-color: #ffffff;
        }
        /* 设置偶数元素颜色 */
        .table tr:nth-child(odd) {
            background-color: #f6f4f0;
        }
        .table tr:hover {
            background-color: #f5f5f5;
        }
    </style>
</head>
<body>
<div class="box">
    <table class="table">
        <tr>
            <th>编号</th>
            <th>姓名</th>
            <th>年龄</th>
        </tr>

        <c:forEach items="${requestScope.students}" var="student">
            <tr>
                <td>${student.id}</td>
                <td>${student.name}</td>
                <td>${student.age}</td>
            </tr>
        </c:forEach>

    </table>
</div>
</body>
</html>
